package com.bw.task.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;

import com.bumptech.glide.Glide;
import com.bw.task.R;
import com.bw.task.adapter.MyAdapter;
import com.bw.task.adapter.MySearchView;
import com.bw.task.bean.History;

import java.util.ArrayList;
import java.util.List;

public class SearchAct extends AppCompatActivity {

    private ImageView bz;
    private EditText edit;
    private CheckBox longmsg;
    private MySearchView mysearch;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_search);
        initView();
        Glide.with(this).load(R.drawable.tt).into(bz);

        List<History> list = new ArrayList<>();
        list.add(new History("强子鞋垫"));
        list.add(new History("强子牌502"));
        list.add(new History("强子牌单杠自行车"));
        list.add(new History("强子牌灭鼠器"));
        list.add(new History("强子牌棉袜"));
        list.add(new History("强子牌裤衩"));
        list.add(new History("强子牌吹风机"));
        list.add(new History("强子牌布鞋"));
        list.add(new History("强子牌皮靴"));
        list.add(new History("强子牌化肥"));

        mysearch.setLayoutManager(new StaggeredGridLayoutManager(1,StaggeredGridLayoutManager.VERTICAL));
        MyAdapter myAdapter = new MyAdapter(R.layout.search_act, list);
        mysearch.setAdapter(myAdapter);

        longmsg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (longmsg.isChecked()){
                    mysearch.setFull(true);
                }else {
                    mysearch.setFull(false);
                }

            }
        });

    }

    private void initView() {
        bz = (ImageView) findViewById(R.id.bz);
        edit = (EditText) findViewById(R.id.edit);
        longmsg = (CheckBox) findViewById(R.id.longmsg);
        mysearch = (MySearchView) findViewById(R.id.mysearch);
    }
}